﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>MatchAdd</title>
    <link href="../Content/bootstrap.css" rel="stylesheet" />
</head>
<body>
    <div class="container  text-center">
        <h1>MatchAdd</h1>
        <div class="row">
            <div class="col-md-12">
                <span>场次编号:</span><input type="text" id="no" /><br />
                <span>场次名称:</span><input type="text" id="name" /><br />
                <span>场次地址:</span><input type="text" id="address" /><br />
                <span>比赛时间:</span><input type="datetime" id="time" /><br />
                <span>场次信息:</span><input type="text" id="info" /><br />
                <input type="button" value="添加"  id="btnMatchAdd"/>
            </div>
        </div>

        <!--<div class="row">
           <div class="col-md-12">
               <table>
                   <tr>
                       <th></th>
                   </tr>
               </table>
           </div>
        </div>-->
    </div>

    <script src="../Scripts/jquery-1.10.2.js"></script>
    <script src="../Scripts/bootstrap.js"></script>
    <script type="text/javascript">
        
        $("#btnMatchAdd").click(function () {

            var no = $("#no").val();
            var name = $("#name").val();
            var address = $("#address").val();
            var time = $("#time").val();
            var info = $("#info").val();

            var data = { MatchNO: no, MatchName: name, MatchAddress: address, MatchTime: time, MatchInfo: info };

            $.ajax({
                url: "/Match/MatchAdd",
                type: "POST",
                data: data,
                dataType: "JSON",
                success: function (rv) {
                    alert(rv == 1 ? "添加成功" : "添加失败，请重试！");
                },
                error: function () {
                    alert("添加失败，请重新添加");
                }
            });
        });
    </script>
</body>
</html>